include ../common.mk

CFLAGS = $(CFLAGS_STD) $(CFLAGS_COMMON) $(CFLAGS_LCM) $(CFLAGS_LCMTYPES) -D_GNU_SOURCE
LDFLAGS = $(LDFLAGS_STD) $(LDFLAGS_COMMON) $(LDFLAGS_LCM) $(LDFLAGS_LCMTYPES)

LDFLAGS += -lpthread

LIBCOMMON=$(LIB_PATH)/libcommon.a
UORC_LIB:=$(LIB_PATH)/libuorc.a
ORCTEST:=$(BIN_PATH)/orc_test

OBJS = uorc.o

all: $(ORCTEST) $(UORC_LIB)


$(UORC_LIB): $(OBJS)
	ar rc $@ $(OBJS) $(LIBCOMMON)

$(ORCTEST): main.o $(OBJS)
	$(CC) -o $@ $(OBJS) $< $(LDFLAGS)

%.o: %.c %.h
	@echo "    [$@]"
	$(CC) $(CFLAGS) -c $<

%.o: %.c
	@echo "    [$@]"
	$(CC) $(CFLAGS) -c $<

clean:
	rm -f main.o $(OBJS) $(ORCTEST) *~

